<template>
    <div>
        <div class="fixed">
            <div style="position: fixed;top:0;left:0; display: flex;width: 100%;">
                <div class="back">
                    <div class="sidetop lefttop">
                        <img class="topimg" src="../assets/angle-left.png" alt="" style="transform: scale(.6);"
                            @click="toback">
                    </div>
                </div>
                <div style="width: 100%;">
                    <van-search v-model="value" shape="round" background="#e0e0e0" placeholder="请输入搜索关键词" @search="onSearch"
                        @clear="onclear" />
                </div>
            </div>
        </div>
        <slot name="df"></slot>
    </div>
</template>

<script lang="ts" setup>
import { ref, defineEmits } from 'vue';
import { useRouter } from 'vue-router';
const router = useRouter()
const emits = defineEmits(['tosearch', 'toclear'])
const value = ref('')
const onSearch = () => {
    emits('tosearch', value.value)
}
const onclear = () => {
    emits('toclear')
}
const toback = () => { router.back() }
</script>

<style scoped>
.fixed {
    height: 95px;
}

.back {
    height: 95px;
    width: 60px;
    background-color: #e0e0e0;
}

.sidetop {
    position: absolute;
    top: 0;
    padding: 0 20px;
    height: 80px;

}

.lefttop {
    left: 0;
}

.topimg {
    position: relative;
    top: 28px;
    vertical-align: top;
    width: 40px;
    height: 40px;
}
</style>